package com.tjian.fafa.user.module.home.service;

import android.view.View;

import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.radar.RadarNearbyInfo;
import com.baidu.mapapi.radar.RadarNearbyResult;

import java.util.ArrayList;
import java.util.List;

public class NewsFragmentService
{
    public void parseDiliverymanBean(RadarNearbyResult res, int i)
    {
        LatLng latLng = res.infoList.get(i).pt;
        String latitude = String.valueOf(latLng.latitude);
        String longitude = String.valueOf(latLng.longitude);
    }

    public RadarNearbyResult addSelfRadarNearbyResult()
    {
        LatLng latLng1 = new LatLng((Float.valueOf("39.904965")), (Float.valueOf("116.327764")));
        LatLng latLng2 = new LatLng((Float.valueOf("39.914965")), (Float.valueOf("116.317764")));

        //两个点
        RadarNearbyInfo radarNearbyInfo1 = new RadarNearbyInfo();
        radarNearbyInfo1.pt = latLng1;
        RadarNearbyInfo radarNearbyInfo2 = new RadarNearbyInfo();
        radarNearbyInfo2.pt = latLng2;

        //点的集合
        List<RadarNearbyInfo> infoList = new ArrayList<RadarNearbyInfo>();
        infoList.add(radarNearbyInfo1);
        infoList.add(radarNearbyInfo2);

        //返回信息集合
        RadarNearbyResult radarNearbyResult = new RadarNearbyResult();
        radarNearbyResult.infoList = infoList;

        return radarNearbyResult;
    }

    /**
     * 上传一次位置
     *
     * @param v
     */
    public void sendLoginUserInfoToMap(View v)
    {

    }

    /*protected void writeJson(HttpServletResponse response,String msg)throws Exception{
        response.setCharacterEncoding("utf-8");
        response.setHeader("Content-Type", "application/json;charset=utf-8");
        response.setContentType("application /json;charset=utf-8");
        Writer writer = response.getWriter();
        writer.write(msg);
        writer.flush();
        writer.close();
    }*/

}

